package com.example.flowermall.controller;

import com.example.flowermall.entity.ProductImg;
import com.example.flowermall.entity.Result;
import com.example.flowermall.service.IProductImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaoman
 * @since 2023-09-26
 */
@RestController
@RequestMapping("/productImg")
public class ProductImgController {
    @Autowired
    IProductImgService productImgService;

    @GetMapping("/getByProductId/{id}")
    public Result getMainByProductId(@PathVariable("id")Integer id){
        ProductImg byProductId = productImgService.getByProductId(id);
        return Result.success(byProductId);
    }

    @GetMapping("/getListByProductId/{id}")
    public Result getListByProductId(@PathVariable("id")Integer id){
        List<ProductImg> listByProductId = productImgService.getListByProductId(id);
        return Result.success(listByProductId);
    }




}
